/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * SplashScreen.java
 *
 * Created on Dec 1, 2011, 12:03:38 AM
 */
package tok.predmeta;
import java.awt.*;
import java.awt.event.ActionListener;
import javax.swing.*;
/**
 *
 * @author root
 */
public class SplashScreen extends javax.swing.JFrame {
private static JProgressBar progressBar = new JProgressBar();
private static SplashScreen execute;
private static int count;   
private static Timer timer1;
//String path = "splash.jpg";
    /** Creates new form SplashScreen */
    public SplashScreen() {
        initComponents();
         Container container = getContentPane();
    container.setLayout(null);

    JPanel panel = new JPanel();
    panel.setSize(500, 300);
    panel.setBorder(new javax.swing.border.EtchedBorder());
    panel.setBackground(new Color(255,255,255));
    panel.setBounds(10,10,480,280);
    panel.setLayout(null);
    container.add(panel);

    JLabel label = new JLabel("Први основни суд у Београду");
    label.setFont(new Font("Verdana",Font.BOLD,18));
    label.setForeground(new Color(112,117,132));
    label.setBounds(20,20,480,180);
    panel.add(label);
     JLabel label1 = new JLabel("Ток обраде захтева");
    label1.setFont(new Font("Verdana",Font.BOLD,14));
    label1.setForeground(new Color(112,117,132));
    label1.setBounds(20,20,450,250);
    panel.add(label1);
    
    progressBar.setMaximum(50);
    progressBar.setBounds(100, 200, 300, 5);
    container.add(progressBar);
    loadProgressBar();
    setSize(500,300);
    setLocationRelativeTo(null);
    setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Први основни суд у Београду - Ток обраде захтева");
        setUndecorated(true);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 502, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 390, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(SplashScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(SplashScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(SplashScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(SplashScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                //new SplashScreen().setVisible(true);
                execute = new SplashScreen(); 
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
     public void loadProgressBar()
{
    ActionListener al = new ActionListener()
    {
            @Override
        public void actionPerformed(java.awt.event.ActionEvent evt)
        {
            count++;
            progressBar.setValue(count);
            if (count == 50){
                timer1.stop();
                //execute.setVisible(false);
                Login L = new Login();
                execute.dispose();
                L.setVisible(true);
                      

            }               
        }};         
    timer1 = new Timer(50, al);
    timer1.start();
}

}
